#include <iostream>
#include <rapidjson/document.h>

int main(int argc, char* argv[])
{
    std::string json_str = "{\"name\":\"张三\",\"number\":[0,1,2,3,4]}";

    rapidjson::Document json_doc;
    json_doc.Parse<0>(json_str.c_str());
    auto& name_val = json_doc["name"];
    std::cout << "name: " << name_val.GetString() << std::endl;

    auto& num_val = json_doc["number"];
    std::cout << "number: " << std::endl;
    if (num_val.IsArray()) {
        for (size_t i=0; i<num_val.Size(); ++i) {
            std::cout << "\t" << num_val[i].GetInt() << std::endl;
        }
    }

    return 0;
}